/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores;

/**
 *
 * @author USER
 */
import Entidades.Cargo;
import java.util.List;
import logica.jpaControllers.CargoJpaController;

public class CtrlCargo {
  public CtrlCargo() {
    }
   
    public void guardarCargo(Cargo art) {
        CargoJpaController ga = new CargoJpaController();
        ga.create(art);
    }
    
    public void eliminarCargo(Cargo cp) throws Exception{
        CargoJpaController ga = new CargoJpaController();
        ga.destroy(cp.getIdCargo());
    }

    public void modificarCargo(Cargo a) throws Exception {
        CargoJpaController ga = new CargoJpaController();
        ga.edit(a);
    }
    
     
    public Cargo buscarCargo_X_idCargo(int idcp){
        CargoJpaController ga = new CargoJpaController();
        return ga.findCargo(idcp);
       
    }
    
    public Cargo buscarCargoNombre(String nom) throws Exception{
        CargoJpaController ga = new CargoJpaController();
        return ga.findCargo_x_nombre(nom);        
    }
     
    public List buscarTodosCargo() throws Exception{        
        CargoJpaController ga = new CargoJpaController();
        return ga.findCargoEntities();
    }
  
}
